package com.perfma.xtest.tool;


import com.google.common.collect.Lists;

import java.util.List;

/**
 * @author: junhui.si
 * @date: 2020-11-03 09:57
 **/
public class ListUtil {
    public static void main(String[] args) {
//        List<User> natures = Lists.newArrayList();
//        Map<Long, User> natureMap = natures.stream().collect(Collectors.toMap(User::getId, m -> m));
//        System.out.println(natureMap);

//        List<String> list = Lists.newArrayList("1wqe", "dfsadasd");
//        System.out.println(list);
//        System.out.println(Double.MAX_VALUE);
//        System.out.println(Double.MIN_VALUE);
//        System.out.println(Float.MAX_VALUE);
//        System.out.println(Float.MIN_VALUE);
//        Pattern pattern = Pattern.compile("\\[([^]]*)]\\[([^]]*)]\\[([^]]*)]\\[([^]]*)]\\[([^]]*)]\\[(.*)]");
//        String s = "[1608729123435][静态规则][2020003][mysql][192.168.0.201:3306/e2e_demo][mysql数据源影子规则未配置,[原始地址 192.168.0.201:3306,库名 e2e_demo]山东省地方]";
//        Matcher matcher = pattern.matcher(s);
//        if(matcher.matches()){
//            System.out.println(matcher.group(1));
//            System.out.println(matcher.group(2));
//            System.out.println(matcher.group(3));
//            System.out.println(matcher.group(4));
//            System.out.println(matcher.group(5));
//            System.out.println(matcher.group(6));
//        }
//        // 根据条件查询到的脚本列表
//        List<Integer> listOfScript = Lists.newArrayList(1,2,3,4,5);
//        // 根据条件查询到的文件夹列表
//        List<Integer> listOfFolder = Lists.newArrayList(3,4,6,8,8);
//
//        // 所有查询匹配的记录列表
//        List<Integer> matchedList = Lists.newArrayList(Iterables.concat(listOfScript, listOfFolder));
//        System.out.println(matchedList);
        List<Integer> smokeIdList = Lists.newArrayList(1,3,3,5,0);

        // 只保留最近一次的冒烟记录
//        List<Integer> needDeleteSmokeIdList = smokeIdList.subList(0, smokeIdList.size() - 1);
//        System.out.println(needDeleteSmokeIdList);

        smokeIdList.sort((o1, o2) -> {
            return o1-o2;
        });
        System.out.println(smokeIdList);
    }
}
